<?php

class IndexController extends BaseController {

    public function actionIndex() {

        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $pc = (strpos($agent, 'windows nt')) ? true : false;
        $iPhone = (strpos($agent, 'iphone')) ? true : false;
        $iPad = (strpos($agent, 'ipad')) ? true : false;
        $android = (strpos($agent, 'android')) ? true : false;

        if($pc) {
            $this->render('index');
        } else if($android || $iPhone) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_phone');
        } else if($iPad) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_platform_phone');
        }
    }

    public function actionIntroPlatform() {
        // http://www.maptopro.com/index/introPlatform

        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $pc = (strpos($agent, 'windows nt')) ? true : false;
        $iPhone = (strpos($agent, 'iphone')) ? true : false;
        $iPad = (strpos($agent, 'ipad')) ? true : false;
        $android = (strpos($agent, 'android')) ? true : false;

        if($pc) {
            $this->render('intro_platform_pc');
        } else if($android || $iPhone) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_platform_phone');
        }
    }

    public function actionIntroEstate() {
        // http://www.maptopro.com/index/introEstate

        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $pc = (strpos($agent, 'windows nt')) ? true : false;
        $iPhone = (strpos($agent, 'iphone')) ? true : false;
        $iPad = (strpos($agent, 'ipad')) ? true : false;
        $android = (strpos($agent, 'android')) ? true : false;

        if($pc) {
            $this->render('intro_estate_pc');
        } else if($android || $iPhone) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_estate_phone');
        } else if($iPad) {
            $this->layout = '//layouts/layout_main_pad';
            $this->render('intro_estate_pad');
        }
    }

    public function actionTry() {

        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $pc = (strpos($agent, 'windows nt')) ? true : false;
        $iPhone = (strpos($agent, 'iphone')) ? true : false;
        $android = (strpos($agent, 'android')) ? true : false;

        if($pc) {
            $this->render('try');
        } else if($android || $iPhone) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('try_phone');
        }
    }

    public function actionBuy() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionBusiness() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionAdvertise() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionAbout() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionJoin() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionContact() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionMedia() {

        $arr = array(
            'title' => 'PainterServer-首页'
        );
        $this->render('index', $arr);
    }

    public function actionIntro() {

        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $pc = (strpos($agent, 'windows nt')) ? true : false;
        $iPhone = (strpos($agent, 'iphone')) ? true : false;
        $iPad = (strpos($agent, 'ipad')) ? true : false;
        $android = (strpos($agent, 'android')) ? true : false;

        if($pc) {
            $this->layout = '//layouts/layout_main_pc';
            $this->render('intro_pc');
        } else if($android) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_phone');
        } else if($iPhone) {
            $this->layout = '//layouts/layout_main_phone';
            $this->render('intro_phone');
        } else if($iPad) {
            $this->layout = '//layouts/layout_main_pad';
            $this->render('intro_pad');
        }
    }
}
